                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          <!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<h2>你好，欢迎访问贵美商城</h2>
		<div id="times"></div>

		<script type="text/javascript">
			function clock_12h() {
				var nowTime = new Date();

				var year = nowTime.getFullYear(); //获取年
				var month = nowTime.getMonth(); //获取月
				var date = nowTime.getDate(); //获取日
				var week = nowTime.getDay(); //获取星期
				var hh = nowTime.getHours(); //获取小时
				var mm = nowTime.getMinutes(); //获取分钟
				var ss = nowTime.getSeconds(); //获取秒
				var am = "";
				if(hh >= 0 && hh <= 12) {
					am = "AM";
				} else {
					am = "PM";
					hh -= 12;
				}
 switch(week){
                case 1:{
                    week="一";
                    break;
                }
                case 2:{
                    week="二";
                    break;
                }
                case 3:{
                    week="三";
                    break;
                }
                case 4:{
                    week="四";
                    break;
                }
                case 5:{
                    week="五";
                    break;
                }
                case 6:{
                    week="六";
                    break;
                }
                case 0:{
                    week="日";
                    break;
                }
            }

				document.getElementById("times").innerHTML = year + "年" + (month + 1) + "月" + date + "日" + "&nbsp;" + hh + ":" + mm + ":" + ss + "&nbsp;" + am + "&nbsp;" + "星期: " + week;

				setInterval("clock_12h()", 1000);
			}
			clock_12h();
		</script>

	</body>

</html>